package com.lightsh.things;

import org.jbox2d.common.Vec2;

import android.graphics.Rect;

import com.lightsh.body.RectangleImpl;
import com.lightsh.gui.PhysicsScreen;
/**
 * 障碍物，该物体会在镜头完全离开它时自动destroy
 * @author Light
 *
 */
public class SkyBarrier extends RectangleImpl{

	public SkyBarrier(PhysicsScreen screen, float x, float y, float halfWidth,
			float halfHeight, float density, float friction, float restitution) {
		super(screen, x, y, halfWidth, halfHeight, density, friction, restitution);
	}

	@Override
	public void update() {
		super.update();
		
		// 判断是否在上方
		if(isUpperRect(mParentScreen.getCurrentRectClone(), mParentScreen.getMeterDividePx())){
			mWorld.destroyBody(mBody);
		}		
	}

}
